

export function debounce(fn, delay) {
    // console.log(delay);
    let timer = null;

    return function (...args) {
        const context = this;
        if (timer) {
            console.log('aa');
            clearTimeout(timer);
        }

        // 清除定时器
        // console.log(12345);

        timer = setTimeout(() => {
            console.log(12347);
            fn.apply(context, args)
        }, delay)
    }
}